package cn.nnxy.zentao.service.impl;

import cn.nnxy.zentao.domain.ZNeed;
import cn.nnxy.zentao.domain.ZNeedWithBLOBs;
import cn.nnxy.zentao.mapper.ZNeedMapper;
import cn.nnxy.zentao.service.NeedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class NeedServiceImpl implements NeedService {
    @Autowired
    ZNeedMapper needMapper;
    @Override
    public List<ZNeed> queryList() {
        return needMapper.selectList();
    }

    @Override
    public ZNeed seletById(Integer id) {
        if (null == id){
            return null;
        }
        return needMapper.selectById(id);
    }

    @Override
    public int saveNeed(ZNeed need) {
        if (null == need ){
            return 0;
        }
        return needMapper.insert(need);
    }

    @Override
    public int updateById(ZNeed need) {
        if (null == need || need.getNeedId() == null){
            return 0;
        }
        return needMapper.updateById(need);
    }

    @Override
    public int deleteById(Integer id) {
        if (id == null){
            return 0;
        }
        return needMapper.deleteById(id);
    }
}
